<?php declare(strict_types=1);

namespace Distributed\Event;

use Distributed\Contract\IEvent;
use UntilDistributed\Log;
use Distributed\Constant;
use Distributed\Group\TransGroupManage;
use Distributed\Group\TransactionManage;
use Communication\TxSocketData;

/**
 * 分发提交
 * @author mg
 */
class ActionCoroutineInsert extends AbstractEvent implements IEvent
{
	/**
	 *
	 * {@inheritDoc}
	 * @see \Distributed\Contract\IEvent::parseEvent()
	 */
	public function parseEvent(int $fd): ?TxSocketData
	{
		$groupId = $this->data->transGroup->groupId;
		
		
		$socketData = & $this->data;
		
		Log::getInstance()->info("txmanage commit start");
		
		
		TransGroupManage::getInstance()->updateCoroutineId($groupId, $this->data->coroutineId);
		
		return TxSocketData::createResponse(Constant::$tx_complete_ok);
	}
}